package com.zengqingfa.algorithm.cz.chapter03.test;

/**
 * @author zengqingfa
 * @className FastSlowTest4
 * @description
 * @create 2021/9/1 19:03
 */
public class FastSlowTest4 {

    public static void main(String[] args) {
        Node<String> first = new Node<String>("aa", null);
        Node<String> second = new Node<String>("bb", null);
        Node<String> third = new Node<String>("cc", null);
        Node<String> fourth = new Node<String>("dd", null);
        Node<String> fifth = new Node<String>("ee", null);
        Node<String> six = new Node<String>("ff", null);
        Node<String> seven = new Node<String>("gg", null);
        first.next = second;
        second.next = third;
        third.next = fourth;
        fourth.next = fifth;
        fifth.next = six;
        six.next = seven;

        //让尾节点指向首节点
        seven.next = first;

    }


    /**
     * 静态内部类 节点
     *
     * @param <T>
     */
    private static class Node<T> {
        private T item;
        private Node next;

        public Node(T item, Node next) {
            this.item = item;
            this.next = next;
        }
    }
}